package stringtest;

public class TestString {
	public static void main ( String[] args ) {
//		int strategyID = 0;
//		String ID;
//		
//		for (int i = 0; i < 2000; i++) {
//			ID = strategyID < 10 ? ("00" + strategyID) : ( strategyID < 100 ? ("0" + strategyID) : strategyID + "");
//			strategyID++;
//			System.out.println(ID);
//		}
		
		String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		byte [] b = s.getBytes();
		int i = 0;
		System.out.println(getString(b, i, 4));
		i += 4;
		System.out.println(getString(b, i, 4));
		
	}
	

	/*
	 * 读取字符串, 从data的第i个字节开始读取length个长度
	 */
	private static String getString(byte[] data, int i, int length) {
		byte [] na = new byte[length];
		for (int j = 0; j < length; j++) {
			na[j] = data[i++];
		}
		String name = new String(na);
		return name;
	}
}
